package com.neutech.controller;

import com.neutech.service.MedicineService;
import com.neutech.service.DepartmentService;
import com.neutech.service.DoctorService;
import com.neutech.service.SchedulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class MedicineController {
//    @Autowired
//    private MenuService menuService;
    /*******************医生___START*************************/
    @Autowired
    private MedicineService medicineService;
    @RequestMapping("/queryMedicine")
    public List<Map<String,Object>> getMedicine(){
        return medicineService.queryMedicine();
    }
    @RequestMapping("/insertMedicine")
    public void insMedicine(@RequestParam Map  map){
        medicineService.insertMedicine(map);
        System.out.println(map.get("MeID"));
    }
    @RequestMapping("/deleteMedicine")
    public void delMedicine(@RequestParam Map  map){
        medicineService.deleteMedicine(map);
        System.out.println(map.get("MeID"));
    }
    @RequestMapping("/updataMedicine")
    public void updMedicine(@RequestParam Map  map){
//        System.out.println("看这里");
//        System.out.println(map);
//        System.out.println("看这里");
        Map<String,Object> map2 = new HashMap<>();
        map2.put("MeID",map.get("MeID"));
        map2.put("MeName",map.get("MeName"));
        map2.put("MeSpecs",map.get("MeSpecs"));
        map2.put("Meprice",map.get("Meprice"));
        map2.put("Meuse",map.get("Meuse"));
        map2.put("Memuch",map.get("Memuch"));
        map2.put("Metime",map.get("Metime"));
        medicineService.updataMedicine(map2);
    }
    /**************************END*******************************/

}
